/**
 * @param {string} s
 * @return {string}
 */
 var removeDuplicates = function(s) {
    let stack = []
    for(let i of s){
      let c = null
      if(stack.length && i === (c = stack.pop())) continue
      c && stack.push(c)
      stack.push(i)
    }
    return stack.join('')
};